Skip to content

Conversation

@juniper-shopify
Copy link
Contributor

Some config parameters, like 'exit on error', 'async' and 'working directory', are generally applicable to all/most cogs.
It makes sense to have a consistent definition for their setter/getter methods.

Many of these definitions exist on the Cog::Config base class, but user still need to specify them multiple times for each cog type.

Now you can set some options globally using a single block

config do
  global do
    # every cog of every time will run with this attribute set, unless overridden by a more specific config specification
    exit_on_error!
  end

  cmd do
    # overrides for all `cmd` cogs
    no_exit_on_error!
  end

  chat(:foo) do
    # overrides for a specifically named `chat` cog
    no_exit_on_error!
  end
end

@juniper-shopify juniper-shopify marked this pull request as ready for review October 31, 2025 22:39
…s of all types

Some config parameters, like 'exit on error', 'async' and 'working directory', are generally applicable to all/most cogs.
It makes sense to have a consistent definition for their setter/getter methods.

Many of these definitions exist on the Cog::Config base class, but user still need to specify them multiple times for each cog type.

Now you can set some options globally using a single block

```
config do
  global do
    # every cog of every time will run with this attribute set, unless overridden by a more specific config specification
    exit_on_error!
  end

  cmd do
    # overrides for all `cmd` cogs
    no_exit_on_error!
  end

  chat(:foo) do
    # overrides for a specifically named `chat` cog
    no_exit_on_error!
  end
end
```
@juniper-shopify juniper-shopify merged commit 3047d8f into main Nov 3, 2025
8 checks passed
Copy link
Contributor Author

Merge activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants